<template>
  <div>
    <el-row :gutter="15">
      <el-form
        ref="elForm"
        :model="formData"
        size="medium"
        label-position="top"
      >
        <el-row type="flex" justify="space-around" align="bottom">
          <el-col :span="15">
            <el-row type="flex" justify="space-around" align="bottom">
              <el-col :span="7">
                <el-form-item label="小区名称">
                  <el-select
                    v-model="formData.community_code"
                    placeholder="请输入"
                    clearable
                    size="small"
                    :style="{ width: '100%' }"
                  >
                    <el-option
                      v-for="(item, index) in list"
                      :key="index"
                      :label="item.name"
                      :value="item.code"
                      :disabled="item.disabled"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="7">
                <el-form-item label="设备名称">
                  <el-input
                    v-model="formData.name"
                    size="small"
                    placeholder="请输入"
                    clearable
                    :style="{ width: '100%' }"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="7">
                <el-form-item label="购买日期">
                  <el-date-picker
                    v-model="picker"
                    size="small"
                    type="daterange"
                    format="yyyy-MM-dd"
                    value-format="yyyy-MM-dd"
                    :style="{ width: '100%' }"
                    start-placeholder="请选择"
                    end-placeholder="请选择"
                    range-separator="-"
                    :timestamp="true"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="4" :offset="9">
            <el-form-item size="large">
              <el-button size="small" @click="resetting">重置</el-button>
              <el-button
                type="primary"
                size="small"
                @click="searchSubmit"
              >查询</el-button>
            </el-form-item>
          </el-col>
        </el-row></el-form>
    </el-row>
  </div>
</template>
<script>
export default {
  components: {},
  props: [],
  data() {
    return {
      formData: {
        community_code: '',
        name: '',
        buy_time: ''
      },
      // 时间
      picker: [],
      list: []
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    // 搜索
    searchSubmit() {
      this.formData.buy_time = this.picker
        .map((item) => item ? +new Date(item) : '')
        .toStr7ing()
      this.$parent.$parent.formData.current = 1
      this.$parent.$parent.formData.buy_time = this.formData.buy_time
      this.$parent.$parent.formData.community_code = this.formData.community_code
      this.$parent.$parent.formData.name = this.formData.name
      this.$parent.$parent.getComponents()
    },
    // 重置
    resetting() {
      this.picker = []
      this.formData = {
        community_code: '',
        name: '',
        buy_time: ''
      }
      this.$parent.$parent.resetting()
    }
  }
}
</script>
<style lang="scss" scoped>
</style>
